package com.itheima.health.dao;

import com.itheima.health.pojo.entity.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MemberDao {
    Integer findMemberCountByDate(String date);
    Integer findMemberCountAfterDate(String date);
    Integer findMemberTotalCount();

    @Select("select *from t_member where name = #{name}")
    Member selectByName(String name);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into t_member values(null, #{fileNumber},#{name}, #{sex}, #{idCard}, #{phoneNumber}, #{regTime}, #{password}, #{email}, #{birthday}, #{remark})")
    void insert(Member member);

    @Select("select * from t_member where telephone=#{telephone}")
    Member getByTelephone(String telephone);
    /**
     *
     * @param id
     * @return
     */
    Member selectById(String id);
}
